<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>MiXiM: D:/Projects/MiXiM/extsrc/mixim/src/base/phyLayer/BaseDecider.h Source File</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>


</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">MiXiM
   &#160;<span id="projectnumber">2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
      <li><a href="dirs.html"><span>Directories</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
    </ul>
  </div>
</div>
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
  initNavTree('a00283.html','');
</script>
<div id="doc-content">
<div class="header">
  <div class="headertitle">
<div class="title">BaseDecider.h</div>  </div>
</div>
<div class="contents">
<div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * BaseDecider.h</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> *  Created on: 24.02.2009</span>
<a name="l00005"></a>00005 <span class="comment"> *      Author: karl</span>
<a name="l00006"></a>00006 <span class="comment"> */</span>
<a name="l00007"></a>00007 
<a name="l00008"></a>00008 <span class="preprocessor">#ifndef BASEDECIDER_H_</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define BASEDECIDER_H_</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &quot;MiXiMDefs.h&quot;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &quot;Decider.h&quot;</span>
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 <span class="keyword">class </span><a class="code" href="a00136.html" title="Represents a changeable mapping (mathematical function) from at least time to Argument::mapped_type.">Mapping</a>;
<a name="l00015"></a>00015 <span class="keyword">class </span><a class="code" href="a00075.html" title="A class to represent the result of a processed packet (that is not noise) by the Decider.">DeciderResult</a>;
<a name="l00016"></a>00016 
<a name="l00017"></a>00017 <span class="preprocessor">#define deciderEV (ev.isDisabled()||!debug) ? ev : ev &lt;&lt; &quot;[Host &quot; &lt;&lt; myIndex &lt;&lt; &quot;] - PhyLayer(Decider): &quot;</span>
<a name="l00018"></a>00018 <span class="preprocessor"></span>
<a name="l00044"></a><a class="code" href="a00020.html">00044</a> <span class="keyword">class </span>MIXIM_API <a class="code" href="a00020.html" title="Provides some base functionality for most common deciders.">BaseDecider</a>: <span class="keyword">public</span> <a class="code" href="a00070.html" title="The basic Decider class.">Decider</a> {
<a name="l00045"></a>00045 <span class="keyword">public</span>:
<a name="l00052"></a><a class="code" href="a00020.html#a7232c10b806ef074db6b1452664cc4a2">00052</a>   <span class="keyword">enum</span> <a class="code" href="a00020.html#a7232c10b806ef074db6b1452664cc4a2" title="The kinds of ControlMessages this Decider sends.">BaseDeciderControlKinds</a> {
<a name="l00054"></a><a class="code" href="a00020.html#a7232c10b806ef074db6b1452664cc4a2ab80ab87167f9836332d1d5678f6aab64">00054</a>     PACKET_DROPPED = 22100,
<a name="l00057"></a><a class="code" href="a00020.html#a7232c10b806ef074db6b1452664cc4a2a1944cc67bf3f0c98342e3975bd05021c">00057</a>     LAST_BASE_DECIDER_CONTROL_KIND
<a name="l00058"></a>00058   };
<a name="l00059"></a>00059 
<a name="l00060"></a>00060 <span class="keyword">protected</span>:
<a name="l00061"></a>00061 
<a name="l00063"></a><a class="code" href="a00020.html#a66b8c7b730a6169202fdb36263b74aaa">00063</a>   <span class="keyword">enum</span> <a class="code" href="a00020.html#a66b8c7b730a6169202fdb36263b74aaa" title="The current state of processing for a signal.">eSignalState</a> {
<a name="l00065"></a><a class="code" href="a00020.html#a66b8c7b730a6169202fdb36263b74aaaa3276f47da7417662597b21ee3afa2d31">00065</a>     <a class="code" href="a00020.html#a66b8c7b730a6169202fdb36263b74aaaa3276f47da7417662597b21ee3afa2d31" title="Signal is received the first time.">NEW</a>,
<a name="l00067"></a><a class="code" href="a00020.html#a66b8c7b730a6169202fdb36263b74aaaaf0a66719215a9be8335546666facaab6">00067</a>     <a class="code" href="a00020.html#a66b8c7b730a6169202fdb36263b74aaaaf0a66719215a9be8335546666facaab6" title="Waiting for the header of the signal.">EXPECT_HEADER</a>,
<a name="l00069"></a><a class="code" href="a00020.html#a66b8c7b730a6169202fdb36263b74aaaa5539b8e545c0676dab0b0efb80dfeeac">00069</a>     <a class="code" href="a00020.html#a66b8c7b730a6169202fdb36263b74aaaa5539b8e545c0676dab0b0efb80dfeeac" title="Waiting for the end of the signal.">EXPECT_END</a>,
<a name="l00070"></a>00070   };
<a name="l00071"></a>00071 
<a name="l00074"></a>00074     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> nbFramesWithInterference;
<a name="l00075"></a>00075     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> nbFramesWithoutInterference;
<a name="l00076"></a>00076 
<a name="l00077"></a>00077     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> nbFramesWithInterferencePartial;
<a name="l00078"></a>00078     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> nbFramesWithoutInterferencePartial;
<a name="l00079"></a>00079 
<a name="l00080"></a>00080     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> nbFramesWithInterferenceDropped;
<a name="l00081"></a>00081     <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> nbFramesWithoutInterferenceDropped;
<a name="l00087"></a><a class="code" href="a00020.html#a5eece8bf532f92912ccbd0a3bc4d6fb0">00087</a>   <span class="keywordtype">double</span> <a class="code" href="a00020.html#a5eece8bf532f92912ccbd0a3bc4d6fb0" title="Sensitivity value for receiving an AirFrame if it &lt;= 0 then no sensitivity check will be done...">sensitivity</a>;
<a name="l00088"></a>00088 
<a name="l00090"></a><a class="code" href="a00215.html">00090</a>   <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="a00215.html" title="Pair of a AirFrame and the state it is in.">tProcessingSignal</a> {
<a name="l00091"></a>00091       <span class="keyword">typedef</span> <a class="code" href="a00070.html#a8532046253d31801ffe4bc56b0d70850">airframe_ptr_t</a> first_type;    
<a name="l00092"></a><a class="code" href="a00215.html#a8d8bd437cfbc3aed968a20cc1a7a2cf2">00092</a>       <span class="keyword">typedef</span> <a class="code" href="a00020.html#a66b8c7b730a6169202fdb36263b74aaa" title="The current state of processing for a signal.">eSignalState</a>   <a class="code" href="a00215.html#a8d8bd437cfbc3aed968a20cc1a7a2cf2" title="first_type is the first bound type">second_type</a>;   
<a name="l00093"></a>00093 
<a name="l00094"></a><a class="code" href="a00215.html#a9e1a097b36bb1ae3338001b8af83d691">00094</a>       first_type  <a class="code" href="a00215.html#a9e1a097b36bb1ae3338001b8af83d691" title="second_type is the second bound type">first</a>;  
<a name="l00095"></a><a class="code" href="a00215.html#adc1fa9d47e6115bd743a57b97c722c36">00095</a>       <a class="code" href="a00020.html#a66b8c7b730a6169202fdb36263b74aaa" title="The current state of processing for a signal.">second_type</a> <a class="code" href="a00215.html#adc1fa9d47e6115bd743a57b97c722c36" title="first is a copy of the first object">second</a>; 
<a name="l00096"></a><a class="code" href="a00215.html#ae02250eef3f42acd459379c607e33722">00096</a>       std::size_t <a class="code" href="a00215.html#ae02250eef3f42acd459379c607e33722" title="second is a copy of the second object">iInterferenceCnt</a>;       
<a name="l00097"></a><a class="code" href="a00215.html#a5e4a7bdf0f72b5d8f887a24c4c47af97">00097</a>       simtime_t   <a class="code" href="a00215.html#a5e4a7bdf0f72b5d8f887a24c4c47af97" title="the next idle time point">busyUntilTime</a>;    
<a name="l00098"></a>00098 
<a name="l00099"></a>00099       <a class="code" href="a00215.html" title="Pair of a AirFrame and the state it is in.">tProcessingSignal</a>()
<a name="l00100"></a>00100             : first(NULL)
<a name="l00101"></a>00101             , second(NEW)
<a name="l00102"></a>00102             , iInterferenceCnt(0)
<a name="l00103"></a>00103           , busyUntilTime(notAgain)
<a name="l00104"></a>00104         {}
<a name="l00105"></a>00105         <a class="code" href="a00215.html" title="Pair of a AirFrame and the state it is in.">tProcessingSignal</a>(first_type f, second_type s)
<a name="l00106"></a>00106             : first(f)
<a name="l00107"></a>00107             , second(s)
<a name="l00108"></a>00108             , iInterferenceCnt(0)
<a name="l00109"></a>00109             , busyUntilTime(notAgain)
<a name="l00110"></a>00110         {}
<a name="l00111"></a>00111       tProcessingSignal(<span class="keyword">const</span> tProcessingSignal&amp; o)
<a name="l00112"></a>00112             : first(o.first)
<a name="l00113"></a>00113             , second(o.second)
<a name="l00114"></a>00114             , iInterferenceCnt(o.iInterferenceCnt)
<a name="l00115"></a>00115             , busyUntilTime(o.busyUntilTime)
<a name="l00116"></a>00116         {}
<a name="l00117"></a>00117       tProcessingSignal&amp; operator=(<span class="keyword">const</span> tProcessingSignal&amp; copy)
<a name="l00118"></a>00118         {
<a name="l00119"></a>00119             first               = copy.first;
<a name="l00120"></a>00120             second              = copy.second;
<a name="l00121"></a>00121             iInterferenceCnt    = copy.iInterferenceCnt;
<a name="l00122"></a>00122             busyUntilTime       = copy.busyUntilTime;
<a name="l00123"></a>00123             <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00124"></a>00124         }
<a name="l00125"></a>00125         <span class="keywordtype">void</span> swap(tProcessingSignal&amp; s)
<a name="l00126"></a>00126         {
<a name="l00127"></a>00127             std::swap(first,               s.first);
<a name="l00128"></a>00128             std::swap(second,              s.second);
<a name="l00129"></a>00129             std::swap(iInterferenceCnt,    s.iInterferenceCnt);
<a name="l00130"></a>00130             std::swap(busyUntilTime,       s.busyUntilTime);
<a name="l00131"></a>00131         }
<a name="l00132"></a>00132         std::size_t interferenceWith(<span class="keyword">const</span> first_type&amp; frame);
<a name="l00133"></a>00133         <span class="keywordtype">void</span> startProcessing(first_type frame, second_type state);
<a name="l00134"></a>00134         std::size_t finishProcessing() {
<a name="l00135"></a>00135             first  = NULL;
<a name="l00136"></a>00136             second = NEW;
<a name="l00137"></a>00137             <span class="keywordflow">return</span> iInterferenceCnt;
<a name="l00138"></a>00138         }
<a name="l00139"></a>00139         <span class="keywordtype">bool</span> isProcessing()<span class="keyword"> const                     </span>{ <span class="keywordflow">return</span> first != NULL; }
<a name="l00144"></a><a class="code" href="a00215.html#a5b698123b757c9e2024f83de10db37a7">00144</a>         std::size_t <a class="code" href="a00215.html#a5b698123b757c9e2024f83de10db37a7" title="Returns the current interference count (how many other frames are on air on processing).">getInterferenceCnt</a>()<span class="keyword"> const        </span>{ <span class="keywordflow">return</span> iInterferenceCnt; }
<a name="l00145"></a>00145         simtime_t   getBusyEndTime()<span class="keyword"> const            </span>{ <span class="keywordflow">return</span> busyUntilTime; }
<a name="l00146"></a>00146         <span class="keywordtype">void</span> clear()                                  { first = NULL; second = NEW; iInterferenceCnt = 0; busyUntilTime = notAgain; }
<a name="l00147"></a>00147   } ReceivedSignal;
<a name="l00148"></a>00148 
<a name="l00150"></a><a class="code" href="a00020.html#a22e578e992fab5ab54fe5fcdf196d9e3">00150</a>   <a class="code" href="a00215.html" title="Pair of a AirFrame and the state it is in.">ReceivedSignal</a> <a class="code" href="a00020.html#a22e578e992fab5ab54fe5fcdf196d9e3" title="Pointer to the currently received AirFrame.">currentSignal</a>;
<a name="l00151"></a>00151 
<a name="l00153"></a><a class="code" href="a00206.html">00153</a>   <span class="keyword">typedef</span> <span class="keyword">struct </span><a class="code" href="a00206.html" title="Data about an currently ongoing ChannelSenseRequest.">tCSRInfo</a> {
<a name="l00154"></a>00154         <span class="keyword">typedef</span> ChannelSenseRequest* first_type;    
<a name="l00155"></a><a class="code" href="a00206.html#a5a8b70e8057f50600ba97c8bf36e7b85">00155</a>         <span class="keyword">typedef</span> simtime_t            <a class="code" href="a00206.html#a5a8b70e8057f50600ba97c8bf36e7b85" title="first_type is the first bound type">second_type</a>;   
<a name="l00156"></a>00156 
<a name="l00157"></a><a class="code" href="a00206.html#ac2e01c51427965a7e6c9cd863b112a83">00157</a>         first_type  <a class="code" href="a00206.html#ac2e01c51427965a7e6c9cd863b112a83" title="second_type is the second bound type">first</a>;  
<a name="l00158"></a><a class="code" href="a00206.html#ad9fbead769d43ac7be266d908a5feb44">00158</a>         <a class="code" href="a00206.html#a5a8b70e8057f50600ba97c8bf36e7b85" title="first_type is the first bound type">second_type</a> <a class="code" href="a00206.html#ad9fbead769d43ac7be266d908a5feb44" title="first is a copy of the first object">second</a>; 
<a name="l00159"></a>00159 
<a name="l00160"></a><a class="code" href="a00206.html#a4f558a56b8a6db320dbf0dec48f7f245">00160</a>     simtime_t   <a class="code" href="a00206.html#a4f558a56b8a6db320dbf0dec48f7f245" title="second is a copy of the second object">canAnswerAt</a>;
<a name="l00161"></a>00161 
<a name="l00162"></a>00162     <a class="code" href="a00206.html" title="Data about an currently ongoing ChannelSenseRequest.">tCSRInfo</a>()
<a name="l00163"></a>00163       : first(NULL)
<a name="l00164"></a>00164       , second()
<a name="l00165"></a>00165       , canAnswerAt()
<a name="l00166"></a>00166     {}
<a name="l00167"></a>00167     <a class="code" href="a00206.html" title="Data about an currently ongoing ChannelSenseRequest.">tCSRInfo</a>(<span class="keyword">const</span> <a class="code" href="a00206.html" title="Data about an currently ongoing ChannelSenseRequest.">tCSRInfo</a>&amp; o)
<a name="l00168"></a>00168       : first(o.first)
<a name="l00169"></a>00169       , second(o.second)
<a name="l00170"></a>00170       , canAnswerAt(o.canAnswerAt)
<a name="l00171"></a>00171     {}
<a name="l00172"></a>00172     tCSRInfo&amp; operator=(<span class="keyword">const</span> tCSRInfo&amp; copy)
<a name="l00173"></a>00173     {
<a name="l00174"></a>00174       first       = copy.first;
<a name="l00175"></a>00175       second      = copy.second;
<a name="l00176"></a>00176       canAnswerAt = copy.canAnswerAt;
<a name="l00177"></a>00177       <span class="keywordflow">return</span> *<span class="keyword">this</span>;
<a name="l00178"></a>00178     }
<a name="l00179"></a>00179     <span class="keywordtype">void</span> swap(tCSRInfo&amp; s)
<a name="l00180"></a>00180     {
<a name="l00181"></a>00181       std::swap(first,       s.first);
<a name="l00182"></a>00182       std::swap(second,      s.second);
<a name="l00183"></a>00183       std::swap(canAnswerAt, s.canAnswerAt);
<a name="l00184"></a>00184     }
<a name="l00185"></a>00185 
<a name="l00186"></a>00186     ChannelSenseRequest *<span class="keyword">const</span> getRequest()<span class="keyword"> const </span>{ <span class="keywordflow">return</span> first; }
<a name="l00187"></a>00187     <span class="keywordtype">void</span> setRequest(ChannelSenseRequest* request) { first = request; }
<a name="l00188"></a>00188     simtime_t_cref getSenseStart()<span class="keyword"> const          </span>{ <span class="keywordflow">return</span> second; }
<a name="l00189"></a>00189     <span class="keywordtype">void</span> setSenseStart(simtime_t_cref start)      { second = start; }
<a name="l00190"></a>00190     simtime_t_cref getAnswerTime()<span class="keyword"> const          </span>{ <span class="keywordflow">return</span> canAnswerAt; }
<a name="l00191"></a>00191     <span class="keywordtype">void</span> setAnswerTime(simtime_t_cref answerAt)   { canAnswerAt = answerAt; }
<a name="l00192"></a>00192     <span class="keywordtype">void</span> clear()                                  { first = NULL; second = canAnswerAt = <a class="code" href="a00070.html#a7fbb5a5f14ae118e40d7db1903be6d51" title="simtime that tells the Phy-Layer not to pass an AirFrame again">Decider::notAgain</a>; }
<a name="l00193"></a>00193   } CSRInfo;
<a name="l00194"></a>00194 
<a name="l00197"></a><a class="code" href="a00020.html#ac6cd60e58a8a557ed511f8193ced4f7e">00197</a>   <a class="code" href="a00206.html" title="Data about an currently ongoing ChannelSenseRequest.">CSRInfo</a> <a class="code" href="a00020.html#ac6cd60e58a8a557ed511f8193ced4f7e" title="pointer to the currently running ChannelSenseRequest and its start-time">currentChannelSenseRequest</a>;
<a name="l00198"></a>00198 
<a name="l00201"></a><a class="code" href="a00020.html#a33e7f02028e78116193d09d6cdbc987e">00201</a>   <span class="keywordtype">int</span> <a class="code" href="a00020.html#a33e7f02028e78116193d09d6cdbc987e" title="index for this Decider-instance given by Phy-Layer (mostly Host-index)">myIndex</a>;
<a name="l00202"></a>00202 
<a name="l00204"></a><a class="code" href="a00020.html#aa22cd5156240713e37578172ba5557ce">00204</a>   <span class="keywordtype">bool</span> <a class="code" href="a00020.html#aa22cd5156240713e37578172ba5557ce" title="toggles display of debugging messages">debug</a>;
<a name="l00205"></a>00205 
<a name="l00206"></a>00206 <span class="keyword">public</span>:
<a name="l00213"></a><a class="code" href="a00020.html#acff4618fa7a9c2e9abf257e60e487de2">00213</a>   <a class="code" href="a00020.html" title="Provides some base functionality for most common deciders.">BaseDecider</a>( <a class="code" href="a00079.html" title="This class is the interface for a Decider to the BasePhyLayer.">DeciderToPhyInterface</a>* phy
<a name="l00214"></a>00214              , <span class="keywordtype">double</span>                 sensitivity
<a name="l00215"></a>00215              , <span class="keywordtype">int</span>                    myIndex
<a name="l00216"></a>00216              , <span class="keywordtype">bool</span>                   debug )
<a name="l00217"></a>00217     : <a class="code" href="a00070.html" title="The basic Decider class.">Decider</a>(phy)
<a name="l00218"></a>00218     , nbFramesWithInterference(0)
<a name="l00219"></a>00219     , nbFramesWithoutInterference(0)
<a name="l00220"></a>00220     , nbFramesWithInterferencePartial(0)
<a name="l00221"></a>00221     , nbFramesWithoutInterferencePartial(0)
<a name="l00222"></a>00222     , nbFramesWithInterferenceDropped(0)
<a name="l00223"></a>00223     , nbFramesWithoutInterferenceDropped(0)
<a name="l00224"></a>00224     , sensitivity(sensitivity)
<a name="l00225"></a>00225     , currentSignal(NULL, NEW)
<a name="l00226"></a>00226     , currentChannelSenseRequest()
<a name="l00227"></a>00227     , myIndex(myIndex)
<a name="l00228"></a>00228     , debug(debug)
<a name="l00229"></a>00229   {
<a name="l00230"></a>00230     currentChannelSenseRequest.clear();
<a name="l00231"></a>00231   }
<a name="l00232"></a>00232 
<a name="l00233"></a>00233   <span class="keyword">virtual</span> ~<a class="code" href="a00020.html" title="Provides some base functionality for most common deciders.">BaseDecider</a>() {}
<a name="l00234"></a>00234 
<a name="l00235"></a>00235 <span class="keyword">public</span>:
<a name="l00242"></a>00242   <span class="keyword">virtual</span> simtime_t <a class="code" href="a00070.html#a130dabc37fec0d579d010de251995558" title="This function processes a AirFrame given by the PhyLayer and returns the time point when Decider want...">processSignal</a>(airframe_ptr_t frame);
<a name="l00243"></a>00243 
<a name="l00246"></a><a class="code" href="a00020.html#ae3c39418955737e6bae1a71a4b86d518">00246</a>     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00020.html#ae3c39418955737e6bae1a71a4b86d518" title="Cancels processing a AirFrame.">cancelProcessSignal</a>() {
<a name="l00247"></a>00247         currentSignal.finishProcessing();
<a name="l00248"></a>00248     }
<a name="l00249"></a>00249 
<a name="l00257"></a>00257   <span class="keyword">virtual</span> <a class="code" href="a00044.html" title="Provides information about the current state of the channel:">ChannelState</a> <a class="code" href="a00070.html#aa9f0dcd955639fa2c16233f4654a82bc" title="A function that returns information about the channel state.">getChannelState</a>() <span class="keyword">const</span>;
<a name="l00258"></a>00258 
<a name="l00271"></a>00271   <span class="keyword">virtual</span> simtime_t <a class="code" href="a00070.html#a93548ff29f4d880ed488785509dd4dd9" title="This function is called by the PhyLayer to hand over a ChannelSenseRequest.">handleChannelSenseRequest</a>(ChannelSenseRequest* request);
<a name="l00272"></a>00272 
<a name="l00283"></a>00283   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00070.html#ae4da9f61748737c85000dd64e07b66a0" title="Called by phy layer to indicate that the channel this radio currently listens to has changed...">channelChanged</a>(<span class="keywordtype">int</span> newChannel);
<a name="l00284"></a>00284 
<a name="l00289"></a>00289   <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a00070.html#a6e4b28a733a18fddec77bb6a3f179be5" title="Method to be called by an OMNeT-module during its own finish(), to enable a decider to do some things...">finish</a>();
<a name="l00290"></a>00290 
<a name="l00291"></a>00291 <span class="keyword">protected</span>:
<a name="l00298"></a>00298   <span class="keyword">virtual</span> <span class="keywordtype">double</span> getFrameReceivingPower(airframe_ptr_t frame) <span class="keyword">const</span>;
<a name="l00299"></a>00299 
<a name="l00306"></a><a class="code" href="a00020.html#a4a8ddbaf158b593d4aabeac39c1d36ad">00306</a>   <span class="keyword">virtual</span> <a class="code" href="a00020.html#a66b8c7b730a6169202fdb36263b74aaa" title="The current state of processing for a signal.">eSignalState</a> <a class="code" href="a00020.html#a4a8ddbaf158b593d4aabeac39c1d36ad" title="Returns the next signal state (END, HEADER, NEW).">getNextSignalState</a>(<a class="code" href="a00020.html#a66b8c7b730a6169202fdb36263b74aaa" title="The current state of processing for a signal.">eSignalState</a> CurState)<span class="keyword"> const </span>{
<a name="l00307"></a>00307       <span class="keywordflow">switch</span>(CurState) {
<a name="l00308"></a>00308             <span class="keywordflow">case</span> NEW:           <span class="keywordflow">return</span> EXPECT_END; <span class="keywordflow">break</span>;
<a name="l00309"></a>00309             <span class="keywordflow">case</span> EXPECT_HEADER: <span class="keywordflow">return</span> EXPECT_END; <span class="keywordflow">break</span>;
<a name="l00310"></a>00310             <span class="keywordflow">default</span>:            <span class="keywordflow">return</span> NEW;        <span class="keywordflow">break</span>;
<a name="l00311"></a>00311       }
<a name="l00312"></a>00312       <span class="keywordflow">return</span> NEW;
<a name="l00313"></a>00313   }
<a name="l00314"></a>00314 
<a name="l00321"></a>00321   <span class="keyword">virtual</span> simtime_t getNextSignalHandleTime(<span class="keyword">const</span> airframe_ptr_t frame) <span class="keyword">const</span>;
<a name="l00322"></a>00322 
<a name="l00332"></a>00332   <span class="keyword">virtual</span> simtime_t processNewSignal(airframe_ptr_t frame);
<a name="l00333"></a>00333 
<a name="l00341"></a><a class="code" href="a00020.html#ab53849078ba0481ea80a8926bdedd5f0">00341</a>   <span class="keyword">virtual</span> simtime_t <a class="code" href="a00020.html#ab53849078ba0481ea80a8926bdedd5f0" title="Processes the end of the header of a received Signal.">processSignalHeader</a>(<a class="code" href="a00070.html#a8532046253d31801ffe4bc56b0d70850">airframe_ptr_t</a> <span class="comment">/*frame*/</span>) {
<a name="l00342"></a>00342     opp_error(<span class="stringliteral">&quot;BaseDecider does not handle Signal headers!&quot;</span>);
<a name="l00343"></a>00343     <span class="keywordflow">return</span> <a class="code" href="a00070.html#a7fbb5a5f14ae118e40d7db1903be6d51" title="simtime that tells the Phy-Layer not to pass an AirFrame again">notAgain</a>;
<a name="l00344"></a>00344   }
<a name="l00345"></a>00345 
<a name="l00351"></a>00351   <span class="keyword">virtual</span> <a class="code" href="a00075.html" title="A class to represent the result of a processed packet (that is not noise) by the Decider.">DeciderResult</a>* createResult(<span class="keyword">const</span> airframe_ptr_t frame) <span class="keyword">const</span>;
<a name="l00352"></a>00352 
<a name="l00362"></a>00362   <span class="keyword">virtual</span> simtime_t processSignalEnd(airframe_ptr_t frame);
<a name="l00363"></a>00363 
<a name="l00368"></a>00368   <span class="keyword">virtual</span> simtime_t processUnknownSignal(airframe_ptr_t frame);
<a name="l00369"></a>00369 
<a name="l00377"></a>00377   <span class="keyword">virtual</span> eSignalState getSignalState(<span class="keyword">const</span> airframe_ptr_t frame) <span class="keyword">const</span>;
<a name="l00378"></a>00378   <span class="keyword">virtual</span> eSignalState setSignalState(<span class="keyword">const</span> airframe_ptr_t frame, eSignalState newState);
<a name="l00379"></a>00379 
<a name="l00384"></a>00384   <span class="keyword">virtual</span> simtime_t handleNewSenseRequest(ChannelSenseRequest* request);
<a name="l00385"></a>00385 
<a name="l00394"></a>00394   <span class="keyword">virtual</span> <span class="keywordtype">void</span> handleSenseRequestEnd(CSRInfo&amp; requestInfo);
<a name="l00395"></a>00395 
<a name="l00401"></a>00401   <span class="keyword">virtual</span> simtime_t canAnswerCSR(<span class="keyword">const</span> CSRInfo&amp; requestInfo) <span class="keyword">const</span>;
<a name="l00402"></a>00402 
<a name="l00408"></a><a class="code" href="a00020.html#a5f79c1bbb4b39c82164e0805e1eeb699">00408</a>   <span class="keyword">typedef</span> std::pair&lt;double, simtime_t&gt; <a class="code" href="a00020.html#a5f79c1bbb4b39c82164e0805e1eeb699" title="Return type of BaseDecider::calcChannelSenseRSSI function.">channel_sense_rssi_t</a>;
<a name="l00419"></a>00419   <span class="keyword">virtual</span> <a class="code" href="a00020.html#a5f79c1bbb4b39c82164e0805e1eeb699" title="Return type of BaseDecider::calcChannelSenseRSSI function.">channel_sense_rssi_t</a> calcChannelSenseRSSI(simtime_t_cref start, simtime_t_cref end) <span class="keyword">const</span>;
<a name="l00420"></a>00420 
<a name="l00427"></a>00427   <span class="keyword">virtual</span> <span class="keywordtype">void</span> answerCSR(<a class="code" href="a00206.html" title="Data about an currently ongoing ChannelSenseRequest.">CSRInfo</a>&amp; requestInfo);
<a name="l00428"></a>00428 
<a name="l00436"></a>00436   <span class="keyword">virtual</span> <span class="keywordtype">void</span> channelStateChanged();
<a name="l00437"></a>00437 
<a name="l00449"></a>00449   <span class="keyword">virtual</span> <span class="keywordtype">void</span> getChannelInfo(simtime_t_cref start, simtime_t_cref end, <a class="code" href="a00070.html#a6baab300e0bec90320dfe956c2d15a57" title="Defines what an AirFrameVector shall be here.">AirFrameVector</a>&amp; out) <span class="keyword">const</span>;
<a name="l00450"></a>00450 
<a name="l00451"></a>00451   <span class="comment">//------Utility methods------------</span>
<a name="l00452"></a>00452 
<a name="l00464"></a>00464   <span class="keyword">virtual</span> <a class="code" href="a00136.html" title="Represents a changeable mapping (mathematical function) from at least time to Argument::mapped_type.">Mapping</a>* calculateSnrMapping(<span class="keyword">const</span> <a class="code" href="a00070.html#a8532046253d31801ffe4bc56b0d70850">airframe_ptr_t</a> frame) <span class="keyword">const</span>;
<a name="l00465"></a>00465 
<a name="l00471"></a><a class="code" href="a00020.html#aa11a3ec12ab83f9223d7bf11279e6226">00471</a>   <span class="keyword">typedef</span> std::pair&lt;Mapping*, channel_sense_rssi_t::second_type&gt; <a class="code" href="a00020.html#aa11a3ec12ab83f9223d7bf11279e6226" title="Return type of BaseDecider::calculateRSSIMapping function.">rssi_mapping_t</a>;
<a name="l00472"></a>00472 
<a name="l00483"></a>00483   <span class="keyword">virtual</span> <a class="code" href="a00020.html#aa11a3ec12ab83f9223d7bf11279e6226" title="Return type of BaseDecider::calculateRSSIMapping function.">rssi_mapping_t</a> calculateRSSIMapping( simtime_t_cref       start
<a name="l00484"></a>00484                                              , simtime_t_cref       end
<a name="l00485"></a>00485                                              , <span class="keyword">const</span> <a class="code" href="a00070.html#a8532046253d31801ffe4bc56b0d70850">airframe_ptr_t</a> exclude = NULL) <span class="keyword">const</span>;
<a name="l00486"></a>00486 };
<a name="l00487"></a>00487 
<a name="l00488"></a>00488 <span class="preprocessor">#endif </span><span class="comment">/* BASEDECIDER_H_ */</span>
</pre></div></div>
</div>
  <div id="nav-path" class="navpath">
    <ul>
      <li class="navelem"><b>BaseDecider.h</b>      </li>

    <li class="footer">Generated on Tue Mar 5 2013 21:26:29 for MiXiM by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.5.1 </li>
   </ul>
 </div>


</body>
</html>
